package com.vlin.device.value.converter.condition;

import com.vlin.device.value.converter.condition.utils.TuyaUtils;

public class TuyaInteger {

	private String unit;
	
	private int min;
	
	private int max;
	
	private int scale;
	
	private int step;
	
	public TuyaInteger(String unit, int min, int max, int scale, int step) {
		super();
		this.unit = unit;
		this.min = min;
		this.max = max;
		this.scale = scale;
		this.step = step;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public int getMin() {
		return min;
	}

	public void setMin(int min) {
		this.min = min;
	}

	public int getMax() {
		return max;
	}

	public void setMax(int max) {
		this.max = max;
	}

	public int getScale() {
		return scale;
	}

	public void setScale(int scale) {
		this.scale = scale;
	}

	public int getStep() {
		return step;
	}

	public void setStep(int step) {
		this.step = step;
	}
	
	

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + max;
		result = prime * result + min;
		result = prime * result + scale;
		result = prime * result + step;
		result = prime * result + TuyaUtils.stringHash(unit);
		return result;
	}
	
	

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TuyaInteger other = (TuyaInteger) obj;
		if (max != other.max)
			return false;
		if (min != other.min)
			return false;
		if (scale != other.scale)
			return false;
		if (step != other.step)
			return false;
		if (unit == null) {
			if (other.unit != null)
				return false;
		} else if (!unit.equals(other.unit))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "TuyaInteger [unit=" + unit + ", min=" + min + ", max=" + max + ", scale=" + scale + ", step=" + step
				+ "]";
	}

}
